package com.university.evaluation.controller;

import com.university.evaluation.common.ResponseResult;
import org.springframework.web.bind.annotation.*;
import java.util.*;

/**
 * 学生信息相关API - 临时实现
 */
@RestController
@RequestMapping("/student-info")
@CrossOrigin(origins = "*")
public class StudentInfoController {

    /**
     * 获取当前学生信息
     */
    @GetMapping("/me")
    public ResponseResult<Map<String, Object>> getMyInfo() {
        Map<String, Object> studentInfo = new HashMap<>();
        studentInfo.put("studentId", "2507240211");
        studentInfo.put("realName", "Ynchen");
        studentInfo.put("className", "计算机科学与技术2021-1班");
        studentInfo.put("college", "信息工程学院");
        studentInfo.put("major", "软件工程");
        studentInfo.put("grade", "2024");
        studentInfo.put("email", "student@university.dev");
        studentInfo.put("phone", "13203094369");
        studentInfo.put("avatar", "http://192.168.182.128:9000/blog/user/avatar/41f86646-eeb2-4ec5-a469-ee591cca7b16.jpg");
        
        return ResponseResult.success("获取学生信息成功", studentInfo);
    }

    /**
     * 获取Dashboard统计数据
     */
    @GetMapping("/dashboard-stats")
    public ResponseResult<Map<String, Object>> getDashboardStats() {
        Map<String, Object> stats = new HashMap<>();
        stats.put("completedEvaluations", 5);
        stats.put("pendingEvaluations", 2);
        stats.put("currentScore", 89.5);
        stats.put("unreadNotifications", 3);
        stats.put("completionRate", 85);
        stats.put("urgentCount", 2);
        stats.put("scoreIncrease", 5);
        
        return ResponseResult.success("获取统计数据成功", stats);
    }

    /**
     * 获取待办事项
     */
    @GetMapping("/todos")
    public ResponseResult<List<Map<String, Object>>> getTodos() {
        List<Map<String, Object>> todos = new ArrayList<>();
        
        Map<String, Object> todo1 = new HashMap<>();
        todo1.put("id", 1);
        todo1.put("title", "2024年春季学期综合测评填报");
        todo1.put("status", "pending");
        todo1.put("deadline", "2024-06-30T23:59:59");
        todos.add(todo1);
        
        Map<String, Object> todo2 = new HashMap<>();
        todo2.put("id", 2);
        todo2.put("title", "上传社会实践证明材料");
        todo2.put("status", "pending");
        todo2.put("deadline", "2024-06-15T23:59:59");
        todos.add(todo2);
        
        Map<String, Object> todo3 = new HashMap<>();
        todo3.put("id", 3);
        todo3.put("title", "填写志愿服务时长");
        todo3.put("status", "pending");
        todo3.put("deadline", "2024-06-20T23:59:59");
        todos.add(todo3);
        
        return ResponseResult.success("获取待办事项成功", todos);
    }

    /**
     * 获取通知列表
     */
    @GetMapping("/notifications")
    public ResponseResult<List<Map<String, Object>>> getNotifications(@RequestParam(defaultValue = "10") int limit) {
        List<Map<String, Object>> notifications = new ArrayList<>();
        
        Map<String, Object> notification1 = new HashMap<>();
        notification1.put("id", 1);
        notification1.put("title", "2024年春季学期综合测评开始啦，请及时完成填报");
        notification1.put("timestamp", "2025-09-14T10:30:00");
        notification1.put("read", false);
        notifications.add(notification1);
        
        Map<String, Object> notification2 = new HashMap<>();
        notification2.put("id", 2);
        notification2.put("title", "系统将于本周六进行维护升级，请提前安排工作");
        notification2.put("timestamp", "2025-09-13T18:00:00");
        notification2.put("read", false);
        notifications.add(notification2);
        
        Map<String, Object> notification3 = new HashMap<>();
        notification3.put("id", 3);
        notification3.put("title", "您的2023-2024学年秋季学期综测成绩已发布");
        notification3.put("timestamp", "2025-09-12T15:30:00");
        notification3.put("read", true);
        notifications.add(notification3);
        
        return ResponseResult.success("获取通知列表成功", notifications.subList(0, Math.min(limit, notifications.size())));
    }

    /**
     * 获取成绩趋势数据
     */
    @GetMapping("/score-trend")
    public ResponseResult<Map<String, Object>> getScoreTrend(@RequestParam(defaultValue = "all") String semester) {
        Map<String, Object> trendData = new HashMap<>();
        
        List<String> periods = Arrays.asList("2022-2023春季", "2022-2023秋季", "2023-2024春季", "2023-2024秋季");
        List<Double> scores = Arrays.asList(82.0, 85.0, 87.0, 89.5);
        
        trendData.put("periods", periods);
        trendData.put("scores", scores);
        
        return ResponseResult.success("获取成绩趋势成功", trendData);
    }
}